<?php
!defined('M_P') && exit('Forbidden');

InitGP(array('page', 'area', 'plate', 'aveprice', 'property', 'buildtype', 'housetype', 'paystatus', 'status', 'perpage', 'order', 'type'), null, 2);
InitGP(array('name'));
$page < 1 && $page = 1;
$perpage = in_array($perpage, array(20, 40, 60)) ? $perpage : 20;
$order = in_array($order, array(0, 1, 2)) ? $order : 0;
$SCR = 'list';
if ($type) {
	Cookie('house_list', $type);
} else {
	$type = getCookie('house_list');
}

$data = array(
	'area'		=> $area,
	'plate'		=> $plate,
	'aveprice'	=> $aveprice,
	'property'	=> $property,
	'buildtype'	=> $buildtype,
	'housetype'	=> $housetype,
	'paystatus'	=> $paystatus,
	'status'	=> $status,
	'name'		=> $name
);
$houseinfo = House::LoadClass('HouseInfo');

$where = $url_add = $houseinfo->paramCheck($data);
$where['ifopen'] = 1;

$perpage > 20 && $url_add['perpage'] = $perpage;
$order > 0 && $url_add['order'] = $order;
$houseBaseUrl = "index.php?m=$m&";
$pageBaseUrl	= "{$basename}q=list";
$pageUrl		= $houseinfo->urlCompound($pageBaseUrl, $url_add);
$perpageUrl		= $houseinfo->urlCompound($pageBaseUrl, $url_add, 'perpage');
$orderUrl		= $houseinfo->urlCompound($pageBaseUrl, $url_add, 'order');

$pages  = $houseinfo->getPages($where, $page, $perpage, $pageUrl.'&');
$infodb = $houseinfo->getList($where, ($page - 1) * $perpage, $perpage, $order);


if ($type != 2 && $hids = array_keys($infodb)) {
	$pw_pricedetaidb = House::LoadDB('Pricedetail');
	$pricedb = $pw_pricedetaidb->getPricedetailByIds($hids);
}

$sel_class = ' class="sel"';
$sel_perpage = array($perpage => ' selected');
$sel_order = array($order => ' selected');

$pageCache = getPageCache('list',$area);
$pageCache->init();

$areaName = $area ? $house_field['area'][$area]['name'] : '';

$houseloginfo  = array();
if (($houselog = GetCookie('houselog')) && ($houselog = explode(',', trim($houselog, ',')))) {
	$houseloginfo = $houseinfo->getListByIds(array_slice($houselog, -6, 6));
}
$searchKey = array('area', 'plate', 'aveprice', 'property', 'buildtype', 'housetype', 'paystatus', 'status');
$ifListQuery = 0;
foreach ($searchKey as $key => $value) {
	if (isset($url_add[$value])) {
		$ifListQuery = 1;
		break;
	}
}
/*seo set start*/
$_seopage = 'thread' ;
/*seo set end*/
require_once(M_P.'require/header.php');
$house_field['status'] = $buildStatus;
$search_tags = $add = '';
require_once PrintEot('list');
footer();	
?>